﻿
@{
    ViewBag.Title = "GRInfoIndex";
    Layout = "~/Views/SharedHead/Enroll.cshtml";
}

<div class="ZC-GeInfo">
    <form action="/Enroll/GRInfoIndex" method="post" enctype="multipart/form-data">
        <div class="GR-potian">
            <h2>完善信息-直接进入</h2>
            <img src="~/TouXiang/morentouxiang.jpg" id="GR-img" alt=""><br>
            <input type="text" id="GR-Name" name="GRName" placeholder="请输入您所希望的名字..."><br>
            <input type="text" id="GR-JianJie" name="GRJianJie" placeholder="请概括您的身份..."><br>
        </div>
        <label id="upload-button" for="GR-TjImg">头像</label>
        <input type="file" id="GR-TjImg" name="GRImg" style="display:none;">
        <button type="submit" id="Tj-Btn">提交</button>
    </form>

    <button type="button" id="Jr-Btn" onclick="window.location='/Home/SquareIndex?WBID=@ViewBag.WBID'">进入</button>
</div>

<script type="text/javascript">
    //显示图片和视频方法
    $(function () {
        //监听input的change事件
        $("#GR-TjImg").change(function () {
            var objUrl = getObjectURL(this.files[0]);
            if (objUrl) {
                $("#GR-img").attr("src", objUrl);
            }
        });

        //建立一個可存取到該file的url
        function getObjectURL(file) {
            var url = null;
            if (window.createObjectURL != undefined) {
                // basic
                url = window.createObjectURL(file);
            } else if (window.URL != undefined) {
                // mozilla(firefox)
                url = window.URL.createObjectURL(file);
            } else if (window.webkitURL != undefined) {
                // webkit or chrome
                url = window.webkitURL.createObjectURL(file);
            }
            return url;
        }
    })

    ////修改头像
    //function uploadImg() {
    //    var formData = new FormData();
    //    formData.append("file", $("#GR-TjImg")[0].files[0]);
    //    $.ajax({
    //        url: "/Home/GRInfoIndex",
    //        type: 'POST',
    //        data: formData,
    //        // 告诉jQuery不要去处理发送的数据
    //        processData: false,
    //        // 告诉equerry不要去设置Content-Type请求头
    //        contentType: false,
    //        beforeSend: function () {//发送之前
    //            console.log("正在进行，请稍候");
    //        },
    //        success: function (data) {

    //        }
    //    });
    //}
</script>